﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace XMM.Controls.Library
{
    /// <summary>
    /// Interaktionslogik für Holster_Plot.xaml
    /// </summary>
    public partial class Holster_Plot : UserControl
    {
        public string Plot { get; set; }

        public Holster_Plot(string sPlot)
        {
            InitializeComponent();

            Plot = sPlot;
        }

        public Holster_Plot()
        {
            InitializeComponent();

            Plot = String.Empty;
        }

        private void btnEditPlot_Click(object sender, RoutedEventArgs e)
        {
            Dialoges.Library.PlotEditor dlgPlotEditor = new XMM.Dialoges.Library.PlotEditor(this, Plot);
            dlgPlotEditor.ShowDialog();
        }

        public void setStatusImage(bool bIsEdited)
        {
            if (bIsEdited)
                imgPlotStatus.Source = new BitmapImage(new Uri(@"../../images/bin/save.png", UriKind.Relative));
            else
                imgPlotStatus.Source = new BitmapImage(new Uri(@"../../images/bin/new.png", UriKind.Relative));
        }

        public void setPlot(string sNewPlot)
        {
            Plot = sNewPlot;
            btnEditPlot.ToolTip = Plot;
            if (Plot == String.Empty)
                setStatusImage(false);
            else
                setStatusImage(true);
        }
    }
}
